package nc.ui.ep.dj;

import nc.itf.fi.pub.Currency;
import nc.ui.pub.ClientEnvironment;
import nc.ui.pub.bill.BillItem;
import nc.ui.pub.bill.IBillModelDecimalListener2;

public class ArapCurrencyDecimalListener implements IBillModelDecimalListener2{

	public String[] getTarget() {
		return new String[]{"bbhl"};
	}

	public int getDecimalFromSource(int row, Object okValue) {
		String defcurrency = okValue.toString();
		String pk_corp = ClientEnvironment.getInstance().getCorporation().getPk_corp();
		String PrimaryKey_corp = ClientEnvironment.getInstance().getCorporation().getPrimaryKey();
		int precision = 0;
		try {
			precision = Currency.getRateDigit(pk_corp, Currency.getLocalCurrPK(PrimaryKey_corp), defcurrency);
		} catch (Exception e) {
			//do nothing
		}
		return precision;
	}

	public String getSource() {
		return "bzbm";
	}

	public boolean isTarget(BillItem item) {
		boolean result = false;
		if("bbhl".equals(item.getKey())){
			result = true;
		}
		return result;
	}
	
}
